<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Utils\QueryUtil;


class CreateTableRandomCheckLogA extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('random_check_logs', function (Blueprint $table) {
            $table->id();
            $table->integer('product_id')->default(0)->comment('产品ID products.id');
            $table->text('content')->comment('巡检内容');
            $table->string('remark', 1024)->default('')->comment('巡检备注');
            $table->string('modules', 1024)->default('')->comment('巡检模块');
            $table->string('note', 1024)->default('')->comment('巡检说明，笔记');
            $table->string('info_imgs', 1024)->default('')->comment('图片说明');
            $table->string('res', 1024)->default('')->comment('巡检结果');
            $table->string('created_adminer')->default('')->comment('接口创建人 如 马文欢(17614322265)');
            $table->string('updated_adminer')->default('')->comment('接口最后修改人 如 马文欢(17614322265)');
            $table->timestamps();

            $table->index('product_id');
        }); QueryUtil::tableComment('random_check_logs', '产品巡检记录表');

        Schema::create('random_check_modules', function (Blueprint $table) {
            $table->id();
            $table->integer('product_id')->default(0)->comment('产品ID products.id');
            $table->string('name', 128)->default('')->comment('模块名称');
            $table->string('remark', 1024)->default('')->comment('模块备注');
            $table->string('created_adminer')->default('')->comment('接口创建人 如 马文欢(17614322265)');
            $table->string('updated_adminer')->default('')->comment('接口最后修改人 如 马文欢(17614322265)');
            $table->string('adminer')->default('')->comment('模块负责人');
            $table->timestamps();

            $table->index('product_id');
        }); QueryUtil::tableComment('random_check_modules', '产品巡检模块表');

        Schema::create('random_check_points', function (Blueprint $table) {
            $table->id();
            $table->integer('product_id')->default(0)->comment('产品ID products.id');
            $table->integer('module_id')->default(0)->comment('模块ID random_check_modules.id');
            $table->text('point')->nullable()->comment('巡检要点');
            $table->text('point_remark')->nullable()->comment('巡检备注');
            $table->string('created_adminer')->default('')->comment('接口创建人 如 马文欢(17614322265)');
            $table->string('updated_adminer')->default('')->comment('接口最后修改人 如 马文欢(17614322265)');
            $table->string('adminer')->default('')->comment('模块负责人');
            $table->timestamps();

            $table->index('product_id');
            $table->index('module_id');
        }); QueryUtil::tableComment('random_check_points', '产品巡检要点表');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('table_random_check_log_a');
    }
}
